package cn.jhc.service;

import javax.annotation.Resource;
import javax.transaction.Transactional;

import org.springframework.stereotype.Service;

import cn.jhc.DAO.GoodsDao;
import cn.jhc.model.Goods;

@Service
public class GoodsService {
	
	private GoodsDao goodsDao;

	public GoodsDao getGoodsDao() {
		return goodsDao;
	}
   @Resource
	public void setGoodsDao(GoodsDao goodsDao) {
		this.goodsDao = goodsDao;
	}
	@Transactional
   public void addGood(Goods goods){
	   	   this.goodsDao.addGood(goods);
   }
	@Transactional
	public void removeGood(int id){
		this.goodsDao.removeGood(id);
	}
	@Transactional
	public Goods findGoodById(int id){
		return this.goodsDao.findGoodBybn(id);
		
	}
	@Transactional
	public void updateGood(Goods goods){
		this.goodsDao.updateGood(goods);
	}
}
